package com.wei.frame.integration;

import android.app.Application;

import androidx.annotation.Nullable;

import com.wei.frame.utils.Preconditions;

import javax.inject.Inject;

import dagger.Lazy;
import retrofit2.Retrofit;

/**
 * 作者：赵若位
 * 时间：2020/12/22 16:48
 * 祈祷：佛珠保佑，永无Bug~
 * 功能：
 */
public class RepositoryManager implements IRepositoryManager {

    @Inject
    Lazy<Retrofit> mRetrofit;
    @Inject
    Application mApplication;

    @Inject
    public RepositoryManager() {

    }

    @Nullable
    @Override
    public synchronized  <T> T bindApiService(Class<T> cls) {
        Preconditions.checkNotNull(cls, "The %s is null~", cls.getClass().getSimpleName());
        return null == mRetrofit ? null : mRetrofit.get().create(cls);
    }
}
